- /* sdmrwput.cpp by K.Tsuru */
- // function ID = 345 DRADIX , BRADIX
- /****************************
- SDouble and SDecimal classes
- output in raw representation
- ****************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
- long SDouble::RawPut(int crlf) const{
- long cCount = 0;
- uint p = 0;
- int nc = 0; //the number of digits and delimters per line
- const int width = (Radix() == DRADIX) ? DFIGURES : BFIGURES;
-
- int nl = displayWidth/(width+1); //the number per line
- uint vsize = figure.size();
- FILE* out = FileStream();
-
- //output negative sign
- if(Sign(345) < 0){ putc('-', out); cCount++; }
-
- cCount += fprintf(out, "%" fTypeFormat".+\n", figure(p++));
-
- for( ; p < vsize; p++){
- cCount += fprintf(out, "%0*" fTypeFormat, width, figure(p));
- nc++;
- if(nc == nl){
- putc('\n', out); cCount++; nc = 0;
- } else if(p < vsize-1){
- putc(' ', out); cCount++;
- }
- }
- //It shows the radix, exponent and size.
- char buff[displayWidth+1];
- if(Type() == REAL){
- if(rdxExp >= 0) sprintf(buff," x %" fTypeFormat"^%d (size = %u)", DRADIX, rdxExp, vsize);
- else sprintf(buff," x %" fTypeFormat"^(%d) (size = %u)", DRADIX, rdxExp, vsize); //outputs when zero
- } else {
- sprintf(buff,"(radix = %" fTypeFormat", size = %u)", BRADIX, vsize);
- }
- if( displayWidth - nc*(width+1) < strlen(buff) ){
- putc('\n', out); cCount++;
- }
- cCount += fprintf(out, "%s", buff);
- if(crlf){ putc('\n', out); cCount++; }
- return cCount;
- }
sdmrwput.cpp : last modifiled at 2017/07/17 15:28:13(1,478 bytes)
created at 2017/10/07 10:21:15
The creation time of this html file is 2017/10/07 10:30:03 (Sat Oct 07 10:30:03 2017).